<?php 
class eventclass_ppmain  extends eventsBase
{ 
	function eventclass_ppmain()
	{
	// fill list of events
		$this->events["BeforeShowList"]=true;

		$this->events["BeforeShowView"]=true;


//	onscreen events

	}
// Captchas functions	

//	handlers

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowList(&$xt,&$templatefile)
{

		global $strSQL,$conn,$strTableName;
global $dal;
$dal_table=$dal->Table("ppmain");
$message = "<br><b>Search by category</b><br>";

//categories
$str = "select count(ID) as numbers, Category from ".$dal_table->TableName()." group by Category";
$rs = CustomQuery($str);
while ($data = db_fetch_array($rs))
{
$category = str_replace(" ","+",$data["Category"]);
$message=$message."<a href=\"ppmain_list.php?ctlSearchFor=".$category."&srchOptShowStatus=0&ctrlTypeComboStatus=0&srchWinShowStatus=0&a=integrated&id=1&criteria=and&value11=".$category."&field1=Category&option1=Contains\">".$data["Category"]." (".$data["numbers"].")</a><br>";
//subcategories
$str2 = "select count(ID) as numbers2, Subcategory from ".$dal_table->TableName()." where Category='".$data["Category"]."' group by Subcategory";
$rs2 = CustomQuery($str2);
while ($data2 = db_fetch_array($rs2))
{
$subcategory = str_replace(" ","+",$data2["Subcategory"]);
$message=$message."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"ppmain_list.php?ctlSearchFor=".$subcategory."&srchOptShowStatus=0&ctrlTypeComboStatus=0&srchWinShowStatus=0&a=integrated&id=1&criteria=and&value11=".$subcategory."&field1=Subcategory&option1=Contains\">".$data2["Subcategory"]." (".$data2["numbers2"].")</a><br>";
}
}

$strInfo = "select * from pppaypal_info";
$rsInfo = CustomQuery($strInfo);
$dataInfo = db_fetch_array($rsInfo);

//paypal form
$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\" method=post target=_blank>
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">
<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">
<input type=\"hidden\" name=\"item_name\" value=\"\">
<input type=\"hidden\" name=\"amount\" value=\"\">
<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">
<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">
<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">
<input type=\"hidden\" name=\"item_number\" value=\"\">
<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">
</FORM>";

$xt->assign("ListLoad", $message);
$xt->assign("info", $info);

$xt->assign("ctlSearchField", "<input type=hidden id=\"ctlSearchField\" value=\"\">");
$xt->assign("ctlSearchOption","<input type=hidden id=\"ctlSearchOption\" value=\"Contains\">");

;		
} // function BeforeShowList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowView(&$xt,&$templatefile,&$values)
{

		    global $dal;
global $strWhereClause,$strTableName,$conn; 
$dal_table=$dal->Table("ppmain");
$rs = $dal_table->Query($strWhereClause,"");
$data = db_fetch_array($rs);


$xt->assign("Category",$data["Category"]);
$xt->assign("Subcategory",$data["Subcategory"]);
$xt->assign("Title",$data["Title"]);
$xt->assign("Price",$data["Price"]);
$xt->assign("Details",$data["Details"]);
$xt->assign("Picture",$data["Picture"]);
$xt->assign("userinfo",$data["UserID"]);

$strInfo = "select * from pppaypal_info";
$rsInfo = CustomQuery($strInfo);
$dataInfo = db_fetch_array($rsInfo);

//paypal form
$info="<FORM name=xclick action=\"https://www.paypal.com/cgi-bin/webscr\" method=post target=_blank>
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"".$dataInfo["PayPalEmailAddress"]."\">
<input type=\"hidden\" name=\"currency_code\" value=\"".$dataInfo["Currency"]."\">
<input type=\"hidden\" name=\"item_name\" value=\"\">
<input type=\"hidden\" name=\"amount\" value=\"\">
<input type=\"hidden\" name=\"cancel_return\" value=\"".$dataInfo["CancelPage"]."\">
<input type=\"hidden\" name=\"return\" value=\"".$dataInfo["SuccessPage"]."\">
<input type=\"hidden\" name=\"notify_url\" value=\"".$dataInfo["IPNPage"]."\">
<input type=\"hidden\" name=\"item_number\" value=\"\">
<input type=\"hidden\" name=\"image_url\" value=\"".$dataInfo["Logo"]."\">
</FORM>";
$xt->assign("info",$info);

;		
} // function BeforeShowView

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
//	onscreen events

} 
?>
